package com.zxbg.dao;

import com.zxbg.domain.FormalApply;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

public interface FormalApplyDao {
    @Insert("insert into formal_apply values(null, #{applicant_id}, #{date}, #{applicant_dept}, #{formal_time}, #{harvest}, #{culture}, #{report}, #{entry_time})")
    public int addNewFormalApply(FormalApply formalApply);

    @Select("select id from formal_apply order by id desc limit 1")
    public int getNewestId();

    @Update("update formal_apply set date = #{date}, formal_time = #{formal_time}, harvest = #{harvest}, culture = #{culture}, report = #{report}, entry_time = #{entry_time} where id = #{id}")
    public int updateFormalApply(FormalApply formalApply);

    @Select("select * from formal_apply where id = #{id}")
    public FormalApply getFormalApplyById(Integer id);

    @Delete("delete from formal_apply where id = #{id}")
    public int deleteProcess(Integer id);
}
